package com.ruoyi.qywx.getway.entity;

import com.ruoyi.common.utils.CollectionUtils;
import com.ruoyi.common.utils.StrUtils;
import com.ruoyi.qywx.entity.ExtFollowContact;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * @author : hcl
 * @Date : 2023/8/22 16:23
 */
@Data
public class QyFollowUser {
    private String userid;
    private String remark;
    private String state;
    private String description;
    private Long createtime;
    private List<QyExternalUserTag> tags;
    private String remark_corp_name;
    private List<String> remark_mobiles;
    private Integer add_way;

    public ExtFollowContact getExternalFollower(String extUserId) {
        ExtFollowContact ext = new ExtFollowContact();
        ext.setExtUserId(extUserId);
        ext.setUserId(userid);
        ext.setRemark(StrUtils.defaultString(remark));
        ext.setDescription(StrUtils.defaultString(description));
        ext.setAddTime(new Date(createtime));
        ext.setIsDelete(false);
        ext.setRemarkCorpName(StrUtils.defaultString(remark_corp_name));
        ext.setRemarkMobiles(CollectionUtils.join(remark_mobiles, StrUtils.COMMA));
        ext.setAddWay(add_way == null ? 0 : add_way);
        ext.setState(StrUtils.defaultString(state));
        ext.setAddTime(new Date());
        return ext;
    }
}
